﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.Windows.Media.DirectShow
{
    public class MediaType : IMediaObject
    {

        private string _name;
        private Guid _rawId;

        public MediaType(string name, Guid rawId)
        {
            this._name = name;
            this._rawId = rawId;
        }

        public Guid RawId
        {
            get
            {
                return _rawId;
            }
        }

        #region IMediaObject Members

        public string Name
        {
            get { return _name; }
        }

        #endregion

        public static bool operator == (MediaType m, MediaType m2)
        {
            return m.Equals(m2);
        }

        public static bool operator !=(MediaType m, MediaType m2)
        {
            return !m.Equals(m2);
        }

        public override bool Equals(object obj)
        {
            if (obj is MediaType)
                return this.RawId.Equals(((MediaType)obj).RawId);

            return base.Equals(obj);
        }

        public override int GetHashCode()
        {
            return _rawId.GetHashCode() >> 1;
        }

        public override string ToString()
        {
            return this.Name;
        }
    }
}
